package Gui;


import java.awt.BorderLayout;
import java.awt.Insets;

import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;

import Main.Defines;
import PlayerStates.FinalLoad;


public class GamePanel extends JPanel{

	
	/**
	 * 
	 */
	private static final long serialVersionUID = 190963559323629157L;
	private static GamePanel ref;
	private GamePanel(){
		setLayout(new BorderLayout(10,10));
		setBorder(new EmptyBorder(new Insets(10,10,10,10)));
		
		StatsPanel.getInstance().update();
		GameBoardPanel.getInstance().update();
		ButtonActionPanel.getInstance().update();
		//System.out.println(StatsPanel.getInstance().getComponents().length);
		add(StatsPanel.getInstance(), BorderLayout.NORTH);
		add(ButtonActionPanel.getInstance(), BorderLayout.EAST);
		add(GameBoardPanel.getInstance(), BorderLayout.CENTER);
		add(BottomStatsPanel.getInstance(), BorderLayout.SOUTH);
		
	}
	public static GamePanel getInstance(){
		if(ref == null){
			ref = new GamePanel();
		}
		return ref;
	}
	// TODO check comments below about correct update() implementation
	// StatsPanel/buttonactionpanel,gameboardpanel, should update, according to player/gamestate
	// 
	public void update(){
//		setLayout(new BorderLayout(10,10));
//		setBorder(new EmptyBorder(new Insets(10,10,10,10)));
//		
		StatsPanel.getInstance().update();
		GameBoardPanel.getInstance().update();
		ButtonActionPanel.getInstance().update();
		BottomStatsPanel.getInstance().update();
//		//System.out.println(StatsPanel.getInstance().getComponents().length);
//		add(StatsPanel.getInstance(), BorderLayout.NORTH);
//		add(ButtonActionPanel.getInstance(), BorderLayout.EAST);
//		add(GameBoardPanel.getInstance(), BorderLayout.CENTER);
		
	}
	
}
